<template>
  <el-dialog
    :title="'文件上传'"
    :close-on-click-modal="false"
    :visible.sync="visible">
      <el-upload
        class="upload-demo"
        drag
        action="http://localhost:7001/api/disk/file/upload"
        :headers="tokenHeader"
        multiple>
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
          <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div> -->
      </el-upload>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="uploadCompeleted()">完成上传</el-button>
        <!-- <el-button type="primary" @click="dataFormSubmit()">确定</el-button> -->
      </span>
  </el-dialog>
</template>

<script>
import Vue from 'vue'
export default {
  data () {
    return {
      visible: false
    }
  },
  computed: {
    tokenHeader () {
      return {
        'Auth-Token': Vue.cookie.get('Auth-Token')
      }
    }
  },
  methods: {
    init () {
      this.visible = true
    },
    uploadCompeleted () {
      this.visible = false
      this.$emit('refreshDataList')
    }
  }
}
</script>

<style lang="scss" scoped>
.el-upload{
  margin: 10px 180px;
}
</style>